package com.tongzhan.controller;

import com.tongzhan.base.Return;
import com.tongzhan.service.DangpaiService;
import com.tongzhan.service.QiaotaiService;
import com.tongzhan.service.XiangxianService;
import com.tongzhan.service.ZongjiaoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * 大屏首页
 *
 * @author htmic
 * @date 2020/8/5
 */
@RequestMapping("/index")
@RestController
public class IndexController {

    @Autowired
    private DangpaiService dangpaiService;
    @Autowired
    private QiaotaiService qiaotaiService;
    @Autowired
    private XiangxianService xiangxianService;
    @Autowired
    private ZongjiaoService zongjiaoService;


    //========================================= 乡贤 start =========================================

    /**
     * 乡贤
     *
     * @param type
     * @param date
     * @return
     */
    @RequestMapping("/xiangxian")
    public Return xiangxian(Integer type, String date) {
        Map<String, Object> map = new HashMap<>();
        //获取乡贤基础信息统计
        Map<String, Object> userInfoList = xiangxianService.getUserInfoList(type, date);
        //获取乡贤活动中心统计
        Map<String, Object> actionCenterList = xiangxianService.getActionCenterList(type, date);
        //获取乡贤参政议政统计
        Map<String, Object> participationList = xiangxianService.getParticipationList(type, date);
        map.put("userInfoList",userInfoList);
        map.put("actionCenterList",actionCenterList);
        map.put("participationList",participationList);
        return Return.getSuccessResult(map);
    }

    //========================================= 乡贤 end =========================================


    //========================================= 党派 start =========================================
    /**
     * 党派
     *
     * @param type
     * @param date
     * @return
     */
    @RequestMapping("/dangpai")
    public Return dangpai(Integer type, String date) {
        Map<String, Object> map = new HashMap<>();
        //获取党派新成员统计
        Map<String, Object> newPersonList = dangpaiService.getNewPersonList(type, date);
        //获取党派活动中心统计
        Map<String, Object> actionCenterList = dangpaiService.getActionCenterList(type, date);
        //获取党派社情民意统计
        Map<String, Object> participationList = dangpaiService.getParticipationList(type, date);
        map.put("newPersonList",newPersonList);
        map.put("actionCenterList",actionCenterList);
        map.put("participationList",participationList);
        return Return.getSuccessResult(map);
    }


    //========================================= 党派 end =========================================


    //========================================= 侨台 start =========================================
    /**
     * 侨台
     *
     * @param type
     * @param date
     * @return
     */
    @RequestMapping("/qiaotai")
    public Return qiaotai(Integer type, String date) {
        Map<String, Object> map = new HashMap<>();
        //获取侨台基础信息统计
        Map<String, Object> userInfoList = qiaotaiService.getUserInfoList(type, date);
        //获取侨台活动中心统计
        Map<String, Object> actionCenterList = qiaotaiService.getActionCenterList(type, date);
//        //获取侨台参政议政统计
//        Map<String, Object> peopleOpinionCountList = qiaotaiService.getPeopleOpinionCount(type, date);
        //民意直通车统计
        Map<String, Object> opinionCarCountList = qiaotaiService.getOpinionCarCount(type, date);

        map.put("userInfoList",userInfoList);
        map.put("actionCenterList",actionCenterList);
        map.put("opinionCarCountList",opinionCarCountList);
        return Return.getSuccessResult(map);
    }
    //========================================= 侨台 end =========================================


    //========================================= 宗教 start =========================================
    /**
     * 宗教
     *
     * @param type
     * @param date
     * @return
     */
    @RequestMapping("/zongjiao")
    public Return zongjiao(Integer type, String date) {
        Map<String, Object> map = new HashMap<>();
        //获取宗教场所统计
        Map<String, Object> religionList = zongjiaoService.getReligionList(type, date);
        //获取宗教人员统计
        Map<String, Object> userInfoList = zongjiaoService.getUserInfoList(type, date);
        //获取收入支出
        Map<String, Object> billList = zongjiaoService.getBillList(type, date);
        //获取财务规范上报次数，活动安全上报次数
        Map<String, Object> billActivityCount = zongjiaoService.getBillActivityCount(type, date);
        //获取综合分析
        Map<String, Object> inspectionList = zongjiaoService.getInspectionList(type, date);
        //获取安全统计
        Map<String, Object> safeList = zongjiaoService.getSafeList(type, date);
        //常规统计
        map.put("conventionalCount",zongjiaoService.conventionalCount());
        //请销假统计
        map.put("leaveCountList",zongjiaoService.leaveCount());
        map.put("religionList",religionList);
        map.put("userInfoList",userInfoList);
        map.put("billList",billList);
        map.put("billActivityCount",billActivityCount);
        map.put("inspectionList",inspectionList);
        map.put("safeList",safeList);
        return Return.getSuccessResult(map);
    }

    //========================================= 宗教 end =========================================

}
